//
//  YKViewVisitLogViewController.m
//  YunKang
//
//  Created by leoking870 on 2017/10/1.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKViewVisitLogViewController.h"
#import "YKViewVisitLogItem.h"
#import "YKHospitalLogHeaderView.h"
#import "YKClientListHeaderView.h"
@interface YKViewVisitLogViewController ()

@end

@implementation YKViewVisitLogViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"查看拜访日志";
    YKHospitalLogHeaderView *headerView = [[[NSBundle mainBundle] loadNibNamed:@"YKHospitalLogHeaderView" owner:self options:nil] lastObject];
    headerView.mYKClientDataDetail = self.mYKClientDataDetail;
    [self.view addSubview:headerView];
    
    [headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.trailing.equalTo(self.view);
    }];
    
    YKClientListHeaderView* listHeaderView = [[YKClientListHeaderView alloc]initWithTitles:@[@"单号",@"业务员",@"拜访人",@"拜访日期"] weights:@[@5,@4,@4,@5]];
    listHeaderView.textFont = [UIFont systemFontOfSize:16];
    listHeaderView.backgroundColor = [UIColor tf_colorWithHexString:@"#1EADFC"];
    listHeaderView.textColor = [UIColor whiteColor];
    [self.view addSubview:listHeaderView];
    [listHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(headerView.mas_bottom);
    }];
    
    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self.view);
        make.top.equalTo(listHeaderView.mas_bottom);
    }];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    self.dataSource.totalPageKey = @"page.totalpage";
    self.dataSource.currentPageKey = @"curpage";
    [self startLoadData];
}

- (NSDictionary *)pageViewControllerParameters {
    return @{
             kTFPageViewControllerItemClass: [YKViewVisitLogItem class],
             kTFPageViewControllerModelClass:[YKViewVisitLogModel class],
             kTFPageViewControllerRequestURL:@"customerDataVisitLog/customerDataVisitLogList.htm",
             kTFPageViewControllerDataKeyPath:@"list",
             kTFPageViewControllerRequestParameter:@{@"cId":self.mYKClientDataDetail.ID}
             };
}

@end
